home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
80.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-17
|
538b
|
31 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
#define INT 1
#define CHAR 2
#define FLOAT 3
main()
{
union utype{
int ival;
char cval;
float fval;
} val;
int typ;
val.ival = 1009;
typ = INT;
if(typ == INT)
printf("%d\n",val.ival);
else if(typ == CHAR)
printf("%c\n",val.cval);
else if(typ == FLOAT)
printf("%f\n",val.fval);
}